package com.sample.snl.frontend.LexicalAnalysis;

public class InNumState extends State {
    Automaton automaton;

    public InNumState(Automaton a) {
        this.automaton = a;
    }

    @Override
    void HandleCharacter(int ch) {
        //LexicalAnalyser.LOG.trace("In Num state.");
        if (!automaton.isDigit(ch)) {
            automaton.unGetChar(automaton.stringBuilder.charAt(automaton.stringBuilder.length() - 1));
            automaton.token = new Token(LexicalAnalyser.line, LexicalAnalyser.column, TokenType.INTC, automaton.stringBuilder.substring(0, automaton.stringBuilder.length() - 1));
            //LexicalAnalyser.LOG.debug("Recognized Token:" + automaton.token);
            automaton.gotToken = true;
        }
    }
}
